package com.bailian.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bailian.common.annotation.Log;
import com.bailian.common.core.controller.BaseController;
import com.bailian.common.core.domain.AjaxResult;
import com.bailian.common.enums.BusinessType;
import com.bailian.system.domain.BlParkService;
import com.bailian.system.service.IBlParkServiceService;
import com.bailian.common.utils.poi.ExcelUtil;
import com.bailian.common.core.page.TableDataInfo;

/**
 * 园区仓库服务Controller
 * 
 * @author ruoyi
 * @date 2025-08-04
 */
@RestController
@RequestMapping("/system/park_service")
public class BlParkServiceController extends BaseController
{
    @Autowired
    private IBlParkServiceService blParkServiceService;

    /**
     * 查询园区仓库服务列表
     */
    @PreAuthorize("@ss.hasPermi('system:park_service:list')")
    @GetMapping("/list")
    public TableDataInfo list(BlParkService blParkService)
    {
        startPage();
        List<BlParkService> list = blParkServiceService.selectBlParkServiceList(blParkService);
        return getDataTable(list);
    }

    /**
     * 导出园区仓库服务列表
     */
    @PreAuthorize("@ss.hasPermi('system:park_service:export')")
    @Log(title = "园区仓库服务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BlParkService blParkService)
    {
        List<BlParkService> list = blParkServiceService.selectBlParkServiceList(blParkService);
        ExcelUtil<BlParkService> util = new ExcelUtil<BlParkService>(BlParkService.class);
        util.exportExcel(response, list, "园区仓库服务数据");
    }

    /**
     * 获取园区仓库服务详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:park_service:query')")
    @GetMapping(value = "/{serviceId}")
    public AjaxResult getInfo(@PathVariable("serviceId") Long serviceId)
    {
        return success(blParkServiceService.selectBlParkServiceByServiceId(serviceId));
    }

    /**
     * 新增园区仓库服务
     */
    @PreAuthorize("@ss.hasPermi('system:park_service:add')")
    @Log(title = "园区仓库服务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BlParkService blParkService)
    {
        return toAjax(blParkServiceService.insertBlParkService(blParkService));
    }

    /**
     * 修改园区仓库服务
     */
    @PreAuthorize("@ss.hasPermi('system:park_service:edit')")
    @Log(title = "园区仓库服务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BlParkService blParkService)
    {
        return toAjax(blParkServiceService.updateBlParkService(blParkService));
    }

    /**
     * 删除园区仓库服务
     */
    @PreAuthorize("@ss.hasPermi('system:park_service:remove')")
    @Log(title = "园区仓库服务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{serviceIds}")
    public AjaxResult remove(@PathVariable Long[] serviceIds)
    {
        return toAjax(blParkServiceService.deleteBlParkServiceByServiceIds(serviceIds));
    }
}
